home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 11 / FM Towns Free Software Collection 11.iso / t_os / shell / ghel / src / main.c < prev    next >
C/C++ Source or Header  |  1995-08-04  |  3KB  |  140 lines

  1. /*
  2.     
  3.     GHEL v1.2
  4.     
  5.         Programed by Keijiro Takahashi (novice)
  6.     
  7. */
  8.  
  9.  
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include <string.h>
  13. #include <winb.h>
  14. #include <te.h>
  15. #include <fntb.h>
  16. #include <gui.h>
  17. #include <egb.h>
  18. #include <file_dlg.h>
  19. #include <guidbg.h>
  20. #include <eintm.h>
  21. #include "type.h"
  22.  
  23.  
  24.  
  25. extern MMIINIT    initDataALRT ;
  26. extern MMIINIT    initDataBASE ;
  27. extern hel helbuf;
  28.  
  29. int APL_init();
  30.  
  31. char    *guiEgbPtr ;
  32.  
  33.  
  34.  
  35.  
  36. /*
  37.  
  38.     Main
  39.  
  40. */
  41. void main()
  42. {
  43.     if(APL_init()==NOERR)
  44.     {
  45.         MMI_ExecSystem();
  46.     }
  47.     TL_free(helbuf.buf);
  48.     FDG_FreeFileDlg();
  49.     FDG_RecovCurDir();
  50.     MMI_Close();
  51. }
  52.  
  53.  
  54.  
  55.  
  56. /*
  57.  
  58.     Initialize
  59.  
  60. */
  61. int APL_init()
  62. {
  63.  
  64.     int    ret ;
  65.     MMICTRL mmi;
  66.  
  67.     mmi.page0=SCREEN16 | SCREENIGNORE;
  68.     mmi.page1=SCREENUNUSED;
  69.     mmi.writePage=0;
  70.     mmi.displayPage=SCREENAVAILABLE;
  71.     mmi.priority=0;
  72.     mmi.mode=SCREENAVAILABLE;
  73.     mmi.width=SCREENEXPAND;
  74.     mmi.move.lupx=-16384;
  75.     mmi.move.lupy=-16384;
  76.     mmi.move.rdwx=16383;
  77.     mmi.move.rdwy=16383;
  78.     mmi.white=15;
  79.     mmi.black=8;
  80.     mmi.gray=7;
  81.     mmi.xor=7;
  82.     mmi.size=0;
  83.     mmi.ptr=NULL;
  84.     mmi.asize=0;
  85.     mmi.aptr=NULL;
  86.  
  87.     if ((ret = MMI_Open(&mmi)) != NOERR)        return ret ;
  88.  
  89.     if ((ret = MMI_initHyper()) < 0)            return ret ;
  90.     if ((ret = MMI_initDialogL40()) < 0)        return ret ;
  91.     if ((ret = MMI_initAlertL40()) < 0)            return ret ;
  92.     if ((ret = MMI_initWindowL40()) < 0)        return ret ;
  93.     if ((ret = MMI_initMessageL40()) < 0)        return ret ;
  94.     if ((ret = MMI_initButtonL40()) < 0)        return ret ;
  95.     if ((ret = MMI_initDrawButtonL40()) < 0)    return ret ;
  96.     if ((ret = MMI_initIconL40()) < 0)            return ret ;
  97.     if ((ret = MMI_initScrollBarL40()) < 0)        return ret ;
  98.     if ((ret = MMI_initTextL40()) < 0)            return ret ;
  99.     if ((ret = MMI_initListMenuL40()) < 0)        return ret ;
  100.     if ((ret = MMI_initNumBoxL40()) < 0)        return ret ;
  101.  
  102.     if ((ret = MMI_Init(&initDataALRT)) < 0)    return ret ;
  103.     if ((ret = MMI_Init(&initDataBASE)) < 0)    return ret ;
  104.  
  105.  
  106.     guiEgbPtr = MMI_GetEgbPtr();
  107.     EIN_initGuiColor();
  108.  
  109.     FDG_SaveCurDir();
  110.     
  111.     if( (ret=FDG_InitFileDlg()) < 0 )
  112.     {
  113.         return(ret);
  114.     }
  115.  
  116.     extern int shell();
  117.     MMI_SendMessage(MMI_GetBaseObj(),MM_SETEXEC,1,shell);
  118.     MMI_CallMessage(MMI_GetApliId(),GM_TITLE,
  119.             (int)"GHEL v1.2   By Keijiro",0);
  120.  
  121.  
  122.     extern char pageStr[];
  123.     extern int pageMsg;
  124.     MMI_SendMessage(pageMsg,MM_SETMSG,1,pageStr);
  125.  
  126.     extern int baseWin;
  127.     WINCTRL    *pctrl;
  128.     MMI_GetControl(&pctrl);
  129.     MMI_SendMessage(baseWin,MM_MOVE,2,
  130.                     (pctrl->bound.rdwx-170)/2,(pctrl->bound.rdwy-226)/2);
  131.  
  132.  
  133.     MMI_SendMessage(MMI_GetBaseObj(),MM_SHOW,0);
  134.  
  135.     extern void idleTask();
  136.     MMI_SetIdleTaskFunc(idleTask);
  137.  
  138.     return NOERR ;
  139. }
  140.